package main

import (
	"fmt"
	"net/http"
	"time"

	"github.com/gin-gonic/gin"
)

func qwe() gin.HandlerFunc {
	return func(c *gin.Context) {
		start := time.Now()
		c.Next()
		end := time.Now()
		p := end.Sub(start)
		fmt.Printf("time:%#v\n", p)

	}
}
func main() {
	r := gin.New()
	usergroup := r.Group("/")
	usergroup.Use(qwe())
	{
		usergroup.GET("/hello", func(c *gin.Context) {
			c.JSON(http.StatusOK, gin.H{
				"message": "你好",
			})
		})
		usergroup.GET("/world", func(c *gin.Context) {
			c.JSON(http.StatusOK, gin.H{
				"message": "世界",
			})
		})
	}
	r.Run(":2533")
}
